
demoApp.factory('LoginService', function() {
  return {
      logged : true,
      name: "Fabio",
      surname: "Biondi",
      role: "owner"
  };
});


// SERVER SIDE STUFF
angular.module('itemServices', ['ngResource']).

factory('Login', function($resource) {    

  return $resource('data/login.php', {}, {  
    query: {method:'GET', params:{catId:'000'}, isArray:false}
  })

}).



factory('LoginValidate', function($resource) {    

  return $resource('data/login.php', {}, {   
     query: {method:'GET', isArray:true}

  })
}).


factory('GetAllProjects', function($resource) {    

  //return $resource('data/map/immobili/categories.json', {}, {   
  return $resource('data/getAllProjects.php', {}, {  
    query: {method:'GET', params:{catId:'000'}, isArray:false}
  })
}).


factory('GetUsersByProjects', function($resource) {    

  return $resource('data/getUsersByProjects.php', {}, {  
    query: {method:'GET', params:{projectId:'000'}, isArray:false}
  })
}).




/*********************************************************
* TIME TRACKING
*************************************************************/
// Get info for a new thread
factory('TimeTrackingGetAll', function($resource) {    

  return $resource('data/timetrackingGetAll.php', {}, {  
     query: {method:'GET', params:{limit: 0}, isArray:false}    
  })
}).

// Get timetracking for a specific user (id) and a specific month (0-11)
factory('TimeTrackingGetMonthByUser', function($resource) {    

  return $resource('data/timeTrackingGetMonthByUser.php', {}, {  
     query: {method:'GET', params:{userId: 0, monthIndex: 0, year: 2013}, isArray:false}    
  })
}).

// Save 
// @param   action    "new" or "update"
// @param   userId
// @param   month
// @param   year
factory('TimeTrackingSave', function($resource) {    

  return $resource('data/timeTrackingSave.php', {}, {  
     query: {method:'GET', params:{action: "new", id: "", label: "", date: "", minutes: 00, tagId: ""}, isArray:false}    
  })
}).



/*********************************************************
* DASHBOARD
*************************************************************/
// Get info for a new thread
factory('DashBoardGetAll', function($resource) {    

  return $resource('data/dashboardGetAll.php', {}, {  
     query: {method:'GET', params:{limit: 0}, isArray:false}    
  })
}).


/*********************************************************
* SETTINGS
*************************************************************/
// Get all Settings
factory('SettingsGetAll', function($resource) {    

  return $resource('data/settingsGetAll.php', {}, {  
     query: {method:'GET', params:{limit: 0}, isArray:false}    
  })
}).


/*********************************************************
* BLOG
*************************************************************/
// DA FARE
// - Edit Comment
// - Edit  


// Get info for a new thread
factory('BlogGetRecentActivities', function($resource) {    

  return $resource('data/blogGetRecentActivities.php', {}, {  
     query: {method:'GET', params:{limit: 0}, isArray:false}    
  })
}).


// Get info for a new thread
factory('BlogGetThreadNew', function($resource) {    

  return $resource('data/blogThreadInfoForNew.php', {}, {  
    query: {method:'GET', isArray:false}
  })
}).


// Get info for an exhistent thread
factory('BlogGetThreadInfo', function($resource) {    

  return $resource('data/blogThreadInfoFilled.php', {}, {  
    query: {method:'GET', isArray:false}
  })
}).


/*********************************************************
* TODO
*************************************************************/
// DA FARE
// - Edit Todo (add attachments, code, ecc.)


factory('TodoGetAll', function($resource) {    

  return $resource('data/todoGetAll.php', {}, {  
    query: {method:'GET', isArray:false}
  })
}).



factory('TodoUpdateItem', function($resource) {    

  return $resource('data/todoUpdateItem.php', {}, {  
    query: {method:'GET', isArray:false}
  })
}).

factory('TodoDeleteItem', function($resource) {    

  return $resource('data/todoItemRemove.php', {}, {  
    query: {method:'GET', params:{id:'xxx'}, isArray:false}    
  })
}).



factory('TodoAddNewCategory', function($resource) {    

  return $resource('data/todoCategoryAdd.php', {}, {  
    query: {method:'GET', params:{label:'xxx'}, isArray:false}    
  })
}).


factory('TodoRemoveCategory', function($resource) {    

  return $resource('data/todoCategoryRemove.php', {}, {  
    query: {method:'GET', params:{id:'xxx'}, isArray:false}    
  })
}).








factory('AllCategories', function($resource) {    

  //return $resource('data/map/immobili/categories.json', {}, {   
  return $resource('immobili_sottoutilizzo.json', {}, {   
  })
}).


factory('ItemsGetAllByCat', function($resource) {   

  //return $resource('data/map/immobili/categories/:catId.json', {}, {
  return $resource('immobili_sottoutilizzo.json', {}, {
    query: {method:'GET', params:{catId:'000'}, isArray:true}
  })
})




/*

demoApp.factory('UserService', function() {
  return {
      name : 'anonymous'
  };
});*/



/*
angular.module('phonecatServices', ['ngResource']).
    factory('Phone', function($resource){
  return $resource('immobili_sottoutilizzo.json', {}, {
    query: {method:'GET', params:{phoneId:'phones'}, isArray:true}
  });
});

*/